package safety;

import java.util.concurrent.atomic.AtomicInteger;

public class Contador {

	//private int cont = 0;
	private AtomicInteger cont = new AtomicInteger(0);

	public Contador() {

	}

	public int next() throws InterruptedException {
		
		Thread.sleep(2);

		return (cont.incrementAndGet());// incrementa antes de retornar a variavel
	}

	public int get() {
		return cont.get();
	}

	

}
